package persentation.presentAdministrator;

import javax.swing.JOptionPane;

import persentation.presentLogin.LoginFrame;

public class ExceptionHandler {
	
	private static AdministratorFrame administratorFrame;
	private static LoginFrame loginFrame;
	private static boolean isSolved=false;
	
	public ExceptionHandler(AdministratorFrame administratorFrame,LoginFrame loginFrame){
		this.administratorFrame=administratorFrame;
		this.loginFrame=loginFrame;
	}
	
	public static void networkException(){
		if (!isSolved) {
			int i=JOptionPane.showConfirmDialog(null,"网络连接中断，请重新登录！","故障",JOptionPane.YES_NO_OPTION);
			if (i==JOptionPane.YES_OPTION) {
				administratorFrame.setVisible(false);
				loginFrame.setVisible(true);
				
			}
			else {
				administratorFrame.setVisible(false);
			}
			isSolved=true;
		}
		
	}

}
